package com.trippin.Utils;

import java.io.Serializable;
import java.util.Comparator;
import java.util.Date;

import com.trippin.DB.entities.Comment;



public class CommentComparator implements Comparator<Comment>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public int compare(Comment comment1, Comment comment2) {
		
		Date date1 = comment1.getDate();
		Date date2 = comment2.getDate();

		if(date1.before(date2)) {
			return 1;
		}
		else if(date1.after(date2)){
			return -1;
		}
		else {
			return 1;
		}
	}

}
